package main

import (
	"fmt"
	"math/rand"
)

func main() {
	var num int
	fmt.Println("请输入一个100以内的数字")
	fmt.Scanln(&num)
	fmt.Println("现在开始猜数")

	var max int = 100
	var min int = 0
	var randNum = rand.Intn(max) + min
	var count = 1

	for randNum != num {
		// if randNum > num {
		// 	max = randNum
		// } else {
		// 	min = randNum
		// 	max = int(math.Min(float64(100-randNum), float64(max)))
		// }

		randNum = rand.Intn(max) + min
		count++
	}

	fmt.Printf("一共猜了%d次", count)

}
